package t

import (
	"fmt"
	"strings"
)

// s := "abcabcbb"
func LengthOfLongestSubstring(s string) int {
	leng := len(s)
	len := 0
	p := 0
	p1 := 1
	for p1 < leng {
		s1 := string([]byte(s[p:p1]))
		tempIndex := strings.Index(s1, string(s[p1]))
		fmt.Println(s1, p, tempIndex, p1, leng)
		if tempIndex != -1 {
			p = p + tempIndex + 1
		} else {
			temp := p1 - p
			if temp > len {
				len = temp
			}
		}
		p1++
	}

	return len + 1
}
